#include<iostream>
using namespace std;

class Solution {
public:
    vector<vector<int> > generateMatrix(int n) {
            vector<vector<int> > nums(n,vector<int>(n));
            int x=0,y=0,circle=n/2,border=0,circlestart=0;
            int i=1;
            for(int c=0;c<circle;c++)
            {
                x=circlestart,y=circlestart;
                while(y<n-1-border)
                {
                    nums[x][y]=i;
                    i++;
                    y++;
                }
                while(x<n-1-border)
                {
                    nums[x][y]=i;
                    i++;
                    x++;
                }

                while(y>border)
                {
                    nums[x][y]=i;
                    i++;
                    y--;
                }
                while(x>border)
                {
                    nums[x][y]=i;
                    i++;
                    x--;
                }
                circlestart++;
                border++;
            }
            if(n%2!=0)
            {
                nums[circlestart][circlestart]=i;
            }
            return nums;
    }
};

int main()
{
    Solution s;
    int n;
    cin>>n;
    vector<vector<int> > v=s.generateMatrix(n);
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<n;j++)
            cout<<v[i][j]<<"\t";
        cout<<endl;
    }
}